// 导入依赖
const express = require('express')
const cfg = require('./config/config')
const mycors = require('./middleware/MyCros')
// 导入数据库处理控制器
const riskController = require('./controller/riskController')
const userController = require('./controller/userController')
const farmlandController = require('./controller/farmLandController')
const pestdiseaseController = require('./controller/pestdiseaseController')
const solidController = require('./controller/solidController')
const weatherController = require('./controller/weatherController')
const gotDevice = require('./controller/ai')
// 调用大模型 根据农田的情况 来获取风险等级以及改良的建议
// 预计在插入新的农田的时候调用
// gotDevice(1)
// 创建app
const app = express()
app.use(mycors)
app.use(express.json()); // 用于解析 application/json
app.use(express.urlencoded({ extended: true })); // 解析表单数据
app.use('/risk',riskController)
app.use('/user',userController)
app.use('/farmland',farmlandController)
app.use('/pestdisease',pestdiseaseController)
app.use('/solid',solidController)
app.use('/weather',weatherController)
app.listen(5000,() => {
  console.log('服务已启动，监听端口5000')
})
